package com.yunxiao.cloud.common.constant;

import com.yunxiao.cloud.common.plugin.CodeGenerator;

/**
 * @description: ExceptionConstant type+五位数字
 * @date: 2019/12/16 13:56
 * @author: yunxiao
 * @version: 1.0
 */
public class ExceptionConstant {

    private ExceptionConstant() {
        // to do nothing
    }

    /**
     * code 格式 type+五位数字，例如3500000
     * ResourceInfo(value = "inOutItem", type = 35)
     */
    public static final String GLOBAL_RETURNS_CODE = "code";
    public static final String GLOBAL_RETURNS_MESSAGE = "message";
    public static final String GLOBAL_RETURNS_DATA = "data";

    /**
     * 正常返回/操作成功
     **/
    public static final String SERVICE_SUCCESS_CODE = "0";
    public static final String SERVICE_SUCCESS_MSG = "操作成功";


    /**
     * 页码或页数输入错误
     */
    public static final String ERROR_PAGE_CODE = "4000";
    public static final String ERROR_PAGE_MSG = "页码或页数输入错误";
    /**
     * 数据写入异常
     */
    public static final String DATA_WRITE_FAIL_CODE = "4016";
    public static final String DATA_WRITE_FAIL_MSG = "输入参数有误";

    /**
     * 没有权限，请联系管理员授权
     **/
    public static final String ERROR_NOT_AUTHORIZED = "4015";
    public static final String ERROR_NOT_AUTHORIZED_MSG = "没有权限，请联系管理员授权";

    /**
     * token生成失败
     **/
    public static final String TOKEN_PRODUCE_CODE = "700";
    public static final String TOKEN_PRODUCE_MSG = "Token生成失败";

    /**
     * 系统运行时未知错误
     **/
    public static final String SERVICE_SYSTEM_ERROR_CODE = "500";
    public static final String SERVICE_SYSTEM_ERROR_MSG = "系统异常，请联系管理员";

    /**
     * 系统运行时未知错误
     **/
    public static final String SERVICE_SECURITY_ERROR_CODE = "505";
    public static final String SERVICE_SECURITY_ERROR_MSG = "web权限配置失败，请联系管理员";

    /**
     * 用户信息  500001
     * type = 5
     */
    private static final String USER_ADD_FAILED_TYPE = "5";
    public static final String USER_ADD_FAILED_CODE = CodeGenerator.generateErrorCode(USER_ADD_FAILED_TYPE, "1");
    public static final String USER_ADD_FAILED_MSG = "添加用户信息失败";



    /**
     * hadoop文件信息
     * type = 10
     */
    private static final String HADOOP_FAILED_TYPE = "10";
    /**
     * 1000001
     */
    public static final String HADOOP_DOWNLOAD_FAILED_CODE = CodeGenerator.generateErrorCode(HADOOP_FAILED_TYPE, "1");
    public static final String HADOOP_DOWNLOAD_FAILED_MSG = "文件下载失败";

    /**
     * mail文件信息
     * type = 15
     */
    private static final String MAIL_FAILED_TYPE = "15";
    /**
     * 1000001
     */
    public static final String MAIL_SEND_FAILED_CODE = CodeGenerator.generateErrorCode(MAIL_FAILED_TYPE, "1");
    public static final String MAIL_SEND_FAILED_MSG = "邮件发送失败";

    /**
     * 系统错误已
     * type = 20
     */
    private static final String SYSTEM_FAILED_TYPE = "20";
    /**
     * 2000001
     */
    public static final String SYSTEM_FAILED_CODE = CodeGenerator.generateErrorCode(SYSTEM_FAILED_TYPE, "1");
    public static final String SYSTEM_FAILED_MSG = "SnowflakeIdWorker 错误";

    public static final String SYSTEM_REDIS_CODE = CodeGenerator.generateErrorCode(SYSTEM_FAILED_TYPE, "2");
    public static final String SYSTEM_REDIS_MSG = "Redis 错误";

    public static final String SYSTEM_JOB_CODE = CodeGenerator.generateErrorCode(SYSTEM_FAILED_TYPE, "3");
    public static final String SYSTEM_JOB_MSG = "定时任务 错误";
}
